<template>
    <div>
        <h1>{{ $store.getters["count/showNum"] }}</h1>
        <h1>这是store中的数据：{{ $store.state.count.num }}</h1>
        <h1>{{ $store.state.str.str }}</h1>
        <button @click="jia">+++++++++++1</button>
        <button @click="jiaN">+++++++++++=nnnnnnnnnn</button>
        <button @click="asyncJia">异步++++++111111111</button>
        <button @click="asyncJiaN">异步++++++nnnnnnnnnnn</button>

    </div>
</template>

<script>
    export default {
        name:"Incre",
        // mounted(){
        //     console.log(this.$store);
        // },
        methods:{
            jia(){
                // this.$store.state.num += 1;
                // console.log(this.$store);
                this.$store.commit("count/add");
            },
            jiaN(){
                this.$store.commit("count/addN",10);
            },
            asyncJia(){
                // console.log(this.$store);
                this.$store.dispatch("count/asyncAdd");
            },
            asyncJiaN(){
                this.$store.dispatch("count/asyncAddN",10);
            }
        }
    }
</script>

<style scoped>

</style>